﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using DTO_QLNS;

namespace ADO_QLNS
{
    class CustomerADO : QLNS_ADO
    {
        CustomerDTO _CustomerDTO;

        public bool CheckLogIn(CustomerDTO dto)
        {
            _Helper.Connect();
            {
                string sql = "SELECT CustomerID FROM Customer WHERE CustomerName = '{0}' and Password = '{1}'";
                sql = String.Format(sql, dto.CustomerName, dto.Password);
                _CustomerDTO = (CustomerDTO)_Helper.exeQuery(sql);
            }
            _Helper.Disconnect();
            return (_CustomerDTO == null);
        }

        public override string InsertString(TransferObject dto)
        {
            _CustomerDTO = (CustomerDTO)dto;
            String sql = "Insert into Customer(CustomerName, Password, Email) values ('{0}','{1}','{2}')";
            return String.Format(sql, _CustomerDTO.CustomerName, _CustomerDTO.Password, _CustomerDTO.Email);
        }

        public override string UpdateString(TransferObject dto)
        {
            throw new NotImplementedException();
        }

        public override string DeleteString(TransferObject dto)
        {
            throw new NotImplementedException();
        }

        protected override object GetDataFromDataRow(System.Data.DataTable dt, int i)
        {
            throw new NotImplementedException();
        }

    }
}
